import javaee14.Business.SaleService;
import javaee14.Model.Drink;
import javaee14.Model.In;
import javaee14.Model.Out;
import javaee14.Model.Users;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.annotations.Test;
import java.text.ParseException;

@ContextConfiguration("classpath*:database-context.xml")
public class Text extends AbstractTestNGSpringContextTests {
    @Autowired
    Drink drink;
    @Autowired
    In in;
    @Autowired
    Out out;
    @Autowired
    Users users;
    @Autowired
    SaleService service;

    @Test
    public void insertdrink(){
        drink.setId(123);
        drink.setName("cunzhang");
        drink.setType("jiangxiang");
        drink.setPrice(561.2);
        drink.setNum(65);
        service.Drinkinsrt(drink);
    }
    @Test
    public void deletedrink(){
        drink.setId(123);
        drink.setName("123456");
        service.Drinkdelete(drink);
    }
    @Test
    public void modifyDrink(){
        drink.setId(123);
        drink.setType("555");
        drink.setName("123456");
        drink.setPrice(1.23);
        drink.setNum(56);
        service.Drinkmodify(drink);
    }
    @Test
    public  void queryDrink(){
        drink.setId(123);
        drink.setName("cunzhang");
        service.Drinkquery(drink);
    }
    @Test
    public void queryDrinkall(){
        service.Drinkqueryall();
    }

    @Test
    public void insertIn()  {
        in.setId(239);
        in.setInprice(65.3);
        in.setInnum(63);
        in.setIntime("2018-12-3 12:24:52");
        in.setWho("yang");
        service.Ininsrt(in);
    }
    @Test
    public void deleteIn(){
        in.setId(234);
        in.setWho("yangwanshun");
        service.Indelete(in);
    }
@Test
    public void queryIn(){
        in.setId(235);
        in.setWho("yangwanshun");
        service.Inquery(in);
}
@Test
    public void queryInall(){ service.Inqueryall(); }

@Test
    public void insertOut(){
        out.setId(123);
        out.setOutprice(698.6);
        out.setOuttime("2020-05-21 12:56:20");
        out.setOutnum(52);
        out.setOutplace("henan");
        out.setWho("yangwanshun");
        service.Outinsrt(out);
}

@Test
public void queryOut(){
        out.setId(123);
        out.setWho("yangwanshun");
        service.Outquery(out);
}
@Test
    public void deleteOut(){
out.setId(123);
out.setWho("yangwanshun");
service.Outdelete(out);
}

@Test
    public void insertUsers(){
        users.setName("123456");
        users.setPassword("***");
        service.Usersinsrt(users);
}
}